define(['../../../../js/lib/other/sweet-alert'],function() {
    return ['$scope','$location', '$interval','$timeout','bizProxy', function($scope,$location,$interval,$timeout,bizProxy) {
    	$scope.$emit("top-show",'true');//顶部显示
    	$scope.$emit('menuTypeLight','loan'); 	//控制底部menu高亮
    	$scope.$emit('bub-menu','true'); 	//隐藏底部menu
    	$scope.$emit('flag-tag','60'); 	//显示底部文字
        $scope.$emit('changeNavTitle','案件详情');
        if(transData.userType==='1'){
            $scope.is_lawyer=true;
        }else {
            $scope.is_lawyer=false;
        }
        $scope.confirmRisk=false;
        $scope.signRisk=false;
        $scope.ht_show=false;
        $scope.moneyWidth={
            'min-width':'0',
            'display': 'inline-block'
        };
        $scope.caseTypeList=transData.storage_baseData.queryCaseTypeList.caseTypeList;
        $scope.caseStageList=transData.storage_baseData.queryCaseStageList.caseStageList;
        $scope.title_shenPi=true;
        $scope.title_anJian=false;
        $scope.title_feiYong=false;
        $scope.title_ziLiao=false;
        $scope.title_geRen=false;
        $scope.con_shenPi=true;
        $scope.con_anJian=false;
        $scope.con_feiYong=false;
        $scope.con_ziLiao=false;
        $scope.con_geRen=false;

        $scope.notify_anJian=false;
        $scope.notify_ziLiao=false;
        $scope.notify_anJian_list=[];
        $scope.notify_ziLiao_list=[];

        $scope.show_anjian_text=true;

        $scope.setSlt=function (slt) {
            $timeout(function () {
                $scope.title_shenPi=false;
                $scope.title_anJian=false;
                $scope.title_feiYong=false;
                $scope.title_ziLiao=false;
                $scope.title_geRen=false;
                $scope.con_shenPi=false;
                $scope.con_anJian=false;
                $scope.con_feiYong=false;
                $scope.con_ziLiao=false;
                $scope.con_geRen=false;
                $scope['title_'+slt]=true;
                $scope['con_'+slt]=true;
                if(slt==='anJian'&&$scope.notify_anJian){
                    if($scope.show_anjian_text){
                        $scope.$emit('flag-tag','60-0'); 	//显示底部文字
                    }else {
                        $scope.$emit('flag-tag','60-1'); 	//显示底部文字
                    }
                }else {
                    $scope.$emit('flag-tag','60'); 	//显示底部文字
                }
            })
        };
        $scope.step1=true;
        $scope.step2=false;
        $scope.step3=false;
        $scope.goNext=function () {
            $scope.$emit('changeNavTitle','合同签约');
            $scope.step1=false;
            $scope.step2=true;
            $scope.step3=false;
        }
        $scope.agree=false;
        $scope.check_agree=function () {
            $scope.agree=!$scope.agree;
        }
        $scope.showMoreFundHt=false;
        $scope.moreFundStyle={
            height:'0px',
            overflow:'hidden'
        }
        $scope.showMoreFund=function () {
            if($scope.showMoreFundHt){
                $scope.showMoreFundHt=false;
                $scope.moreFundStyle={
                    height:'0px',
                    overflow:'hidden',
                    transition: 'all 0.3s'
                }
            }else{
                $scope.showMoreFundHt=true;
                $scope.moreFundStyle={
                    height:$scope.caseInfo.fundDetail.length*36+'px',
                    overflow:'hidden',
                    transition: 'all 0.3s'
                }
            }
        }
        queryCaseInfoDetail();
        function queryCaseInfoDetail(){
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;

            bizInfo.caseId = bodyInfo.caseId;
            $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("queryCaseInfoDetail",headerInfo,bizInfo,
            function(tempData){//SUCCESS
                $scope.$emit("loadingChange",false);
                console.log(JSON.parse(tempData.body));
                var res=JSON.parse(tempData.body);
                if(tempData.isSuccess==='T'){
                    //案件状态：1未提交；2已提交；3业务审核通过；4风控审核通过；5已承接；0已关闭；A审核拒绝B待委托；C已委托
                    //风险投状态：1合同未确认；2合同已确认；3合同已签约；4财务已审核；5财务已放款；6部分已回款；0已关闭；A审核拒绝
                    $timeout(function(){
                        var maxLength=0;
                        try{
                            if(res.riskApplyInfo.status=='2'&&transData.userType==='1'){
                                $scope.confirmRisk=true;
                                $scope.signRisk=true;
                            }
                            if(res.riskApplyInfo.status==='3'||res.riskApplyInfo.status==='D'||res.riskApplyInfo.status==='4'||res.riskApplyInfo.status==='5'||res.riskApplyInfo.status==='6'||res.riskApplyInfo.status==='0'){
                                if(transData.userType==='1'){
                                    $scope.ht_show=true;
                                }
                            }
                            if((res.caseAmt+'').length>=(res.riskApplyInfo.applyAmt).length){
                                $scope.moneyWidth={
                                    'min-width':(res.caseAmt+'').length*7+3+'px',
                                    display: 'inline-block'
                                };
                                maxLength=(res.caseAmt+'').length;
                            }else {
                                $scope.moneyWidth={
                                    'min-width':(res.riskApplyInfo.applyAmt).length*7+3+'px',
                                    'display': 'inline-block'
                                };
                                maxLength=(res.riskApplyInfo.applyAmt).length;
                            }
                        }catch (e){console.log(e)}
                        $scope.riskApplyInfo=res.riskApplyInfo;
                        $scope.caseInfo=res;
                        res.fundDetail.forEach(function (item) {
                            if((item.fundAmt+'').length>=maxLength){
                                maxLength=(item.fundAmt+'').length;
                                $scope.moneyWidth={
                                    'min-width':maxLength*7+3+'px',
                                    'display': 'inline-block'
                                };
                            }
                        })
                        if(transData.userType==='1'){
                            $scope.accountName=res.accountInfo.accountName;
                            $scope.accountNo=res.accountInfo.accountNo;
                            $scope.openBankName=res.accountInfo.openBankName;
                            $scope.accountType=res.accountInfo.accountType;
                        }
                        var docDetail=[],riskDocDetail=[],query_docKindList=transData.storage_baseData.queryDocKindList.docKindList,docKindId='';
                        for(var i=0;i<query_docKindList.length;i++){
                            if(query_docKindList[i].docKindName==='意见函'){
                                docKindId=query_docKindList[i].docKindId
                            }
                        }
                        res.docDetail.forEach(function (item) {
                            item.docUrl_show=item.docUrl.replace(window.winhc_oss_url,'').replace(window.old_winhc_oss_url,'').replace(/[A-Z|A-z|2-8]{10}/,'');
                            if(item.docGroup==='apply'){
                                docDetail.push(item);
                                $scope.has_docDetail=true;
                            }
                            if(item.docGroup==='approve'&&item.docKindId==docKindId){
                                riskDocDetail.push(item);
                                $scope.has_riskDocDetail=true;
                            }
                        })
                        $scope.docDetail=docDetail;
                        $scope.riskDocDetail=riskDocDetail;
                        var list=transData.storage_baseData.queryCaseStageList.caseStageList;
                        for(var i=0;i<list.length;i++){
                            if(list[i].caseStageId==res.caseStageId){
                                this_caseStageName=list[i].caseStageName;
                                $timeout(function () {
                                    if(list[i].caseStageName==='未立案'){
                                        $scope.caseNo_expectClosePeriod_style={
                                            overflow: 'hidden',transition:' all 0.3s','-webkit-transition': 'all 0.3s',height: '0px','padding-right': '20px',width: '100%','box-sizing': 'content-box'
                                        }
                                    }else {
                                        $scope.caseNo_expectClosePeriod_style={
                                            overflow: 'hidden',transition:' all 0.3s','-webkit-transition': 'all 0.3s',height: '80px','padding-right': '20px',width: '100%','box-sizing': 'content-box'
                                        }
                                    }
                                    if(list[i].caseStageName==='执行'){
                                        $scope.judgeName_havePropertyClue_style={
                                            overflow: 'hidden',transition:' all 0.3s','-webkit-transition': 'all 0.3s',height: '120px','padding-right': '20px',width: '100%','box-sizing': 'content-box'
                                        }
                                    }else {
                                        $scope.judgeName_havePropertyClue_style={
                                            overflow: 'hidden',transition:' all 0.3s','-webkit-transition': 'all 0.3s',height: '0px','padding-right': '20px',width: '100%','box-sizing': 'content-box'
                                        }
                                    }
                                })
                                break
                            }
                        }
                    });
                    queryCaseApproveList()
                }
            },function(data){
                console.log(data);
                $scope.$emit("loadingChange",false);
                if(data.errorMsg){
                    $scope.$emit("promptAlertMsg",data.errorMsg);
                    $scope.$emit("showCollect",true);
                    $timeout(function(){
                        $scope.$emit("showCollect",false);
                    },transData.promptTime);
                }
            });
        }

        function queryCaseApproveList(){
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;

            bizInfo.caseId= bodyInfo.caseId;
            $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("queryCaseApproveList",headerInfo,bizInfo,
                function(tempData){//SUCCESS
                    $scope.$emit("loadingChange",false);
                    console.log(JSON.parse(tempData.body));
                    if(tempData.isSuccess==='T'){
                        $timeout(function(){
                            var approveList=[];
                            JSON.parse(tempData.body).approveList.forEach(function (item) {
                                if(item.approveAction==='bizApprove'||item.approveAction==='riskApprove'){
                                    approveList.push(item)
                                }
                            });
                            $scope.approveList=approveList;
                            if(approveList.length>0){
                                $scope.has_approveList=true;
                            }
                        });
                        queryCaseInfoNotifyList(true)
					}
                },function(data){
                    console.log(data);
                    $scope.$emit("loadingChange",false);
                    if(data.errorMsg){
                        $scope.$emit("promptAlertMsg",data.errorMsg);
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                        },transData.promptTime);
                    }
                });
        }
        function queryCaseInfoNotifyList(slt){
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;

            bizInfo.caseId= bodyInfo.caseId;
            // $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("queryCaseInfoNotifyList",headerInfo,bizInfo,
                function(tempData){//SUCCESS
                    // $scope.$emit("loadingChange",false);
                    console.log(JSON.parse(tempData.body));
                    if(tempData.isSuccess==='T'){
                        $timeout(function(){
                            $scope.notify_anJian_list=[];
                            $scope.notify_ziLiao_list=[];
                            $scope.notify_anJian=false;
                            $scope.notify_ziLiao=false;
                            if($scope.title_anJian){
                                $scope.$emit('flag-tag','60'); 	//显示底部文字
                            }
                            JSON.parse(tempData.body).infoNotifyList.forEach(function (item) {
                                item.slt=false;
                                if(item.infoType=='1'&&item.infoSign=='1'){
                                    $scope.notify_anJian=true;
                                    $scope.notify_anJian_list.push(item);
                                    if($scope.title_anJian){
                                        $scope.$emit('flag-tag','60-0'); 	//显示底部文字
                                    }
                                }else if(item.infoType=='3'&&item.infoSign=='1'){
                                    $scope.notify_ziLiao=true;
                                    $scope.notify_ziLiao_list.push(item);
                                }
                            })
                        });
                        try{
                            if(slt&&transData.userType==='1'){
                                console.log($scope.riskApplyInfo.applyId);
                                if($scope.riskApplyInfo.applyId){
                                    queryRiskFeeRule()
                                }
                            }
                        }catch (e){console.log(e)}
					}
                },function(data){
                    console.log(data);
                    // $scope.$emit("loadingChange",false);
                    if(data.errorMsg){
                        $scope.$emit("promptAlertMsg",data.errorMsg);
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                        },transData.promptTime);
                    }
                });
        }
        $scope.open=function (index) {
            $timeout(function () {
                $scope.notify_ziLiao_list[index].slt=true;
            })
        }
        $scope.close=function (index) {
            $timeout(function () {
                $scope.notify_ziLiao_list[index].slt=false;
            })
        }
        $scope.open_anJian=function (index) {
            $timeout(function () {
                $scope.notify_anJian_list[index].slt=true;
            })
        }
        $scope.close_anJian=function (index) {
            $timeout(function () {
                $scope.notify_anJian_list[index].slt=false;
            })
        }
        $scope.confirmCaseInfoNotify=function (id) {
            if(!$scope.show_anjian_text){
                $scope.$emit("promptAlertMsg",'请先提交修改信息');
                $scope.$emit("showCollect",true);
                $timeout(function(){
                    $scope.$emit("showCollect",false);
                },transData.promptTime);
                return;
            }
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;

            bizInfo.id= id;
            // $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("confirmCaseInfoNotify",headerInfo,bizInfo,
                function(tempData){//SUCCESS
                    // $scope.$emit("loadingChange",false);
                    console.log(tempData);
                    if(tempData.isSuccess==='T'){
                        queryCaseInfoNotifyList(false)
                    }
                },function(data){
                    console.log(data);
                    // $scope.$emit("loadingChange",false);
                    if(data.errorMsg){
                        $scope.$emit("promptAlertMsg",data.errorMsg);
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                        },transData.promptTime);
                    }
                });
        }
        function queryRiskFeeRule(){
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;

            bizInfo.applyId =$scope.riskApplyInfo.applyId;
            $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("queryRiskFeeRule",headerInfo,bizInfo,
                function(tempData){//SUCCESS
                    $scope.$emit("loadingChange",false);
                    console.log(JSON.parse(tempData.body));
                    if(tempData.isSuccess==='T'){
                        $timeout(function(){
                            var feeRule=JSON.parse(tempData.body);
                            $scope.feeRule=feeRule;
                            //1固定比例；2阶梯比例；3阶梯累进
                            if(feeRule.feeMode=='1'){
                                $scope.feeModeHtml=feeRule.feeRate+' %'
                            }else if(feeRule.feeMode=='2'||feeRule.feeMode=='3'){
                                var str='',str2='';
                                feeRule.feeRangeList.forEach(function (item) {
                                    if(item.endRange*1<=0){
                                        str2+='<p>'+item.startRange+' 万 以上（'+item.feeRate+'%）</p>';
                                    }else {
                                        str+='<p>'+item.startRange+' 万 -- '+item.endRange+' 万 （'+item.feeRate+'%）</p>';
                                    }
                                })
                                $scope.feeModeHtml=str+str2
                            }
                            if(feeRule.isOverdueRule=='Y'){
                                $scope.isOverdueRuleHtml='自放款之日起（'+feeRule.overdueMonth+'月）未回款的，赢火虫分配比例增加（'+feeRule.overdueAddRate+'%）'
                            }
                            if(feeRule.isReconcilRule=='Y'){
                                $scope.isReconcilRuleHtml='和解金额不得低于（'+feeRule.reconcilMinAmt+'万元），否则以（'+feeRule.reconcilDealNum+'万元）作为案件回款金额计算合作收益'
                            }
                        });
					}
                },function(data){
                    console.log(data);
                    $scope.$emit("loadingChange",false);
                    if(data.errorMsg){
                        $scope.$emit("promptAlertMsg",data.errorMsg);
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                        },transData.promptTime);
                    }
                });
        }
        $scope.lock_ht=function () {
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;

            bizInfo.applyId =$scope.riskApplyInfo.applyId;
            $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("queryRiskContract",headerInfo,bizInfo,
                function(tempData){//SUCCESS
                    $scope.$emit("loadingChange",false);
                    var bodyData=JSON.parse(tempData.body)
                    console.log(bodyData);
                    if(tempData.isSuccess==='T'){
                        if(bodyData.linkUrl){
                            if(_YHC_isWEIXIN.isWeiXin()){
                                window.location = bodyData.linkUrl;
                            }else{
                                cordova.InAppBrowser.open(bodyData.linkUrl, '_blank', 'location=yes');
                            }
                        }
                    }
                },function(data){
                    console.log(data);
                    $scope.$emit("loadingChange",false);
                    if(data.errorMsg){
                        $scope.$emit("promptAlertMsg",data.errorMsg);
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                        },transData.promptTime);
                    }
                });
        }
        $scope.go_signRiskContract=function () {
            if($scope.agree){
                $scope.step1=false;
                $scope.step2=false;
                $scope.step3=true;
            }else {
                showCheck('请先确认上诉内容');
            }
        }
        $scope.done_signRiskContract=function () {
            if(!$scope.accountName){
                showCheck('请填写账户名称');
                return;
            }
            if($scope.accountNo){
                if(isNaN($scope.accountNo)){
                    showCheck('账号填写有误');
                    return;
                }
            }else {
                showCheck('账号填写有误');
                return;
            }
            if(!$scope.openBankName){
                showCheck('请填写开户银行名称');
                return;
            }
            if(!$scope.accountType){
                showCheck('请填写账户类型');
                return;
            }
            if($scope.accountName!==$scope.caseInfo.accountInfo.accountName||$scope.accountNo!==$scope.caseInfo.accountInfo.accountNo||$scope.openBankName!==$scope.caseInfo.accountInfo.openBankName||$scope.accountType!==$scope.caseInfo.accountInfo.accountType){
                setupAccountInfo()
            }else {
                signRiskContract()
            }
        }
        var signRiskContract=function (){
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;

            bizInfo.applyId = $scope.riskApplyInfo.applyId;
            console.log(bizInfo);
            $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("signRiskContract",headerInfo,bizInfo,
                function(tempData){//SUCCESS
                    $scope.$emit("loadingChange",false);
                    if(tempData.isSuccess==='T'){
                        var bodyData = JSON.parse(tempData.body);
                        console.log(tempData);
                        if(bodyData.signUrl){
                            if(_YHC_isWEIXIN.isWeiXin()){
                                window.location = bodyData.signUrl;
                            }else{
                                cordova.InAppBrowser.open(bodyData.signUrl, '_blank', 'location=yes');
                            history.back()
                            }
                            // $scope.$emit("goNext","/queryInvest");
                        }
                    }
                },function(data){
                    $scope.$emit("loadingChange",false);
                    console.log(data);
                    if(data.errorMsg){
                        $scope.$emit("promptAlertMsg",data.errorMsg);
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                        },transData.promptTime);
                    }
                });
        }

        var setupAccountInfo=function (){
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;

            bizInfo.accountName=$scope.accountName;
            bizInfo.accountNo=$scope.accountNo;
            bizInfo.openBankName=$scope.openBankName;
            bizInfo.accountType=$scope.accountType;
            console.log(bizInfo);
            $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("setupAccountInfo",headerInfo,bizInfo,
                function(tempData){//SUCCESS
                    $scope.$emit("loadingChange",false);
                    if(tempData.isSuccess==='T'){
                        signRiskContract()
                    }
                },function(data){
                    $scope.$emit("loadingChange",false);
                    console.log(data);
                    if(data.errorMsg){
                        $scope.$emit("promptAlertMsg",data.errorMsg);
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                        },transData.promptTime);
                    }
                });
        }
        var this_caseStageName=''
        $scope.change_caseStageId=function () {
            var list=transData.storage_baseData.queryCaseStageList.caseStageList;
            for(var i=0;i<list.length;i++){
                if(list[i].caseStageId==$scope.caseInfo.caseStageId){
                    this_caseStageName=list[i].caseStageName;
                    $timeout(function () {
                        if(list[i].caseStageName==='未立案'){
                            $scope.caseNo_expectClosePeriod_style={
                                overflow: 'hidden',transition:' all 0.3s','-webkit-transition': 'all 0.3s',height: '0px','padding-right': '20px',width: '100%','box-sizing': 'content-box'
                            }
                        }else {
                            $scope.caseNo_expectClosePeriod_style={
                                overflow: 'hidden',transition:' all 0.3s','-webkit-transition': 'all 0.3s',height: '80px','padding-right': '20px',width: '100%','box-sizing': 'content-box'
                            }
                        }
                        if(list[i].caseStageName==='执行'){
                            $scope.judgeName_havePropertyClue_style={
                                overflow: 'hidden',transition:' all 0.3s','-webkit-transition': 'all 0.3s',height: '120px','padding-right': '20px',width: '100%','box-sizing': 'content-box'
                            }
                        }else {
                            $scope.judgeName_havePropertyClue_style={
                                overflow: 'hidden',transition:' all 0.3s','-webkit-transition': 'all 0.3s',height: '0px','padding-right': '20px',width: '100%','box-sizing': 'content-box'
                            }
                        }
                    })
                    break
                }
            }
        }
        $scope.$on('backAllButtonClick',function () {
            if($scope.step2){
                $timeout(function () {
                    $scope.step1=true;
                    $scope.step2=false;
                    $scope.step3=false;
                    $scope.$emit('changeNavTitle','案件详情');
                })
            }else if($scope.step3){
                $timeout(function () {
                    $scope.step1=false;
                    $scope.step2=true;
                    $scope.step3=false;
                })
            }else{
                history.back()
            }
        });
        $scope.$on('topNavEditTextEvent',function (event) {
            if($scope.show_anjian_text){
                $scope.$emit('flag-tag','60-1'); 	//显示底部文字
                $scope.show_anjian_text=false;
            }else {
                if(!$scope.caseInfo.caseTypeId){
                    showCheck('请选择案件类型');
                }else if(!$scope.caseInfo.creditorName){
                    showCheck('原告不能为空');
                }else if(!$scope.caseInfo.debtorName){
                    showCheck('被告不能为空');
                }else if(!$scope.caseInfo.caseStageId){
                    showCheck('案件阶段不能为空');
                }else if(!$scope.caseInfo.courtName){
                    showCheck('管辖法院不能为空');
                }/*else if(_SYT_util.isErrorAmount($scope.caseInfo.caseAmt+'')){
                    showCheck('案件标的有误');
                }else if(Number($scope.caseInfo.caseAmt+'')>9999999999){
                    showCheck('案件标的过长');
                }*/else if(this_caseStageName!=='未立案'&&!$scope.caseInfo.caseNo){
                    showCheck('案号不能为空');
                }else if($scope.caseInfo.expectClosePeriod &&_SYT_util.isErrorAmount($scope.caseInfo.expectClosePeriod+'')){
                    showCheck('拟结案期限有误');
                }else if(Number($scope.caseInfo.expectClosePeriod+'')>24){
                    showCheck('拟结案期限过长');
                }else if($scope.caseInfo.specLawyerMobileNo && !_SYT_util.isValidNo($scope.caseInfo.specLawyerMobileNo+'')){
                    showCheck('手机号有误');
                }else{
                    modifyCaseInfo();
                }
            }
        });
        var showCheck=function (text){
            $scope.$emit("promptAlertMsg",text);
            $scope.$emit("showCollect",true);
            $timeout(function(){
                $scope.$emit("showCollect",false);
            },transData.promptTime);
        };
        function modifyCaseInfo() {
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;

            bizInfo.caseId=$scope.caseInfo.caseId;
            bizInfo.creditorName=$scope.caseInfo.creditorName;
            bizInfo.debtorName=$scope.caseInfo.debtorName;
            if(this_caseStageName!=='未立案'){
                bizInfo.caseNo=$scope.caseInfo.caseNo;
                bizInfo.expectClosePeriod=$scope.caseInfo.expectClosePeriod||'';
            }else {
                bizInfo.caseNo='';
                bizInfo.expectClosePeriod='';
            }
            if(this_caseStageName==='执行'){
                bizInfo.referCaseNo=$scope.caseInfo.referCaseNo||'';
                bizInfo.judgeName=$scope.caseInfo.judgeName||'';
                bizInfo.havePropertyClue=$scope.caseInfo.havePropertyClue||'';
            }else {
                bizInfo.referCaseNo='';
                bizInfo.judgeName='';
                bizInfo.havePropertyClue='';
            }
            if(this_caseStageName==='结案'||this_caseStageName==='执行'){
                bizInfo.caseBizMode='3'
            }else {
                bizInfo.caseBizMode='1'
            }
            bizInfo.caseMemo=$scope.caseInfo.caseMemo||'';
            bizInfo.caseTypeId=$scope.caseInfo.caseTypeId;
            bizInfo.caseStageId=$scope.caseInfo.caseStageId;
            bizInfo.courtName=$scope.caseInfo.courtName;
            bizInfo.caseAmt=$scope.caseInfo.caseAmt;
            if($scope.caseInfo.isSpecLawyer){
                bizInfo.isSpecLawyer=$scope.caseInfo.isSpecLawyer;
            }
            if($scope.caseInfo.specLawyerName){
                bizInfo.specLawyerName=$scope.caseInfo.specLawyerName;
            }
            if($scope.caseInfo.specLawyerMobileNo){
                bizInfo.specLawyerMobileNo=$scope.caseInfo.specLawyerMobileNo;
            }
            console.log(bizInfo);
            $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("modifyCaseInfo",headerInfo,bizInfo,
                function(tempData){//SUCCESS
                    console.log(tempData)
                    $scope.$emit("loadingChange",false);
                    if(tempData.isSuccess==='T'){
                        $scope.$emit('flag-tag','60-0'); 	//显示底部文字
                        $scope.show_anjian_text=true;
                        $scope.$emit("promptAlertMsg",'修改成功');
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                        },transData.promptTime);
                    }
                },function(data){
                    $scope.$emit("loadingChange",false);
                    console.log(data);
                    if(data.errorMsg){
                        $scope.$emit("promptAlertMsg",data.errorMsg);
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                        },transData.promptTime);
                    }
                });
        }

        $scope.scrollToTop=function(ele){
            if(_YTG_IOSorANDROID.systemJudge()==='Android'){
                var offsetTop=document.querySelector(ele).offsetTop;
                if(offsetTop&&!$scope.show_anjian_text){
                    _fire_eleSorollToTarget('#investDetail_scroll',offsetTop-90,300)
                }
            }
        }
        $scope.$apply();
    }];
});